package com.xuan.yubi.bizmq;

import com.xuan.yubi.constant.RabbitMqConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class BiMessageProducer {


    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendMessage(String message) {
        // 向交换机发送待生成的图表 id
        log.info("[sendMessage], message: {}", message);
        rabbitTemplate.convertAndSend(RabbitMqConstant.EXCHANGE_NAME, RabbitMqConstant.ROUTING_KEY, message);
    }

}
